#include <bits/stdc++.h>

template<class T>
struct  Student {         // struct struct_name {};
// private:
    // 1. attribute, member  
    int    age;      // default: public
// public:
    float  height;        // atrribute
    float  weight;
    int    grade;         // 
    T      var;   //
    std::string schostdol;   // char = 'wenjiangerzhong';   string means multi char
    int*   arr;
    int*   arr;

    // 2. method
    void sing(int x, int a) {template<class T>
        std::cout << "I'm sing a song!" << std::endl;
        coust << agel
        // do something here
    }

    // 3. construct method/function
    Student(int _age, float _h, float _w, int _g, std::string _school) {
        age    = _age;
        height = _h;
        weight = _w;
        grade  = _g;
        school = _school;

        // 
        arr = new int(10);   // 4bytes, value = 10  heap memory
        // arr = new int[10];   // 4bytes*10, default  0;
    }

    Student(int _age, float _h, float _w, int _g) {
        age    = _age;
        height = _h;
        weight = _w;
        grade  = _g;
        // school = _school;
    }

    Student() {   // delete
    }  // 

    // 4. destruct method/function
    ~Student() {
        if (arr != nullptr) {
            delete arr;
            // delete[] arr;
        }        
    }
};


// C++ 
int add(int x, int y) { return x + y; }   // 1
// int add(int x, int y) { return x + y; }   // 2
float add(float x, float y) { return x + y; }  // 3
int add(int x, int y, int z) { return x + y + z; }   // 4


int main() {
    //! stu1 : zhan neicun
    // Student stu1(Student<int>(28, 175.0, 70, 10, "wenjiangerzhang"));    // stu1 => object, instance
    Student<int>  stu1(28, 175.0, 70, 10, "wenjiangerzhang");               // stu1 => object, instance
    Student<int> stu2;        // int a, b;

    stu1.~Student();   //  deleter arr
    // stu1.age    = 18;    // 
    // stu2.age    = 25;    // 
    // stu1.school = "wenjiangerzhong";
    // stu2.school = "tinghua";       // tinghua unisersity, peking university


    // std::cout << stu1.age << ", " << stu1.height << ", " << stu1.school << std::endl;

    Student<int>* stu3 = new Student<int>(28, 175.0, 70, 10, "wenjiangerzhang");   //  new 

    // int a;  // zhan neicun
    // int* b = new int(2);   // int b = 2;
    // stu1.sing();

    // free <==> malloc    free(p);
    // new  <==> delete
    // 3. differ
    //!  set default value for heap  memory object
    //!  set random  value for stack memory object
    // std::cout << stu3->age << ", " << stu3->height << ", " << stu3->school << std::endl;
template<class T>

    // delete b;              //! Error: delete(b);
    // delete stu3;


    return 0;
}template<class T>template<class T>